#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
#logging.basicConfig(level=logging.INFO)
logging.basicConfig(filename='xgits.log', filemode="w", level=logging.INFO)
import pdb
import sys

'这个是冯秀伟专用的python工具库'
__author__='fengxw'
def find_dir(start_path , name):
	target=[]
	for root , dirs ,files in os.walk(start_path , topdown=False):
		for dir_item in dirs:
			if name == dir_item:
				target.append(os.path.join(root , dir))
#	logging.info(target)
	return target

def find_dir_father_path(start_path , name):
	target=[]
	#logging.info("all has .git folder's path +++++++++++++>")
	for root , dirs ,files in os.walk(start_path , topdown=False):
		for dir_item in dirs:
			if name == dir_item:
				#logging.info(root)
				target.append(root)
	#logging.info("all has .git folder's path ------------->")
	return target

def clear(lists ,  key):
	def f(x): return x.find(key,0)==-1
	return filter(f , lists)
